sudo: false
language: cpp
matrix:
  include:
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.4']
      env: SCRIPT=test _CC=gcc-4.4 _CXX=g++-4.4
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.6']
      env: SCRIPT=test _CC=gcc-4.6 _CXX=g++-4.6
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.7']
      env: SCRIPT=test _CC=gcc-4.7 _CXX=g++-4.7
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.8']
      env: SCRIPT=test _CC=gcc-4.8 _CXX=g++-4.8 SANITIZE=address
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.9']
      env: SCRIPT=test _CC=gcc-4.9 _CXX=g++-4.9 SANITIZE=leak
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-5']
      env: SCRIPT=test _CC=gcc-5 _CXX=g++-5 # SANITIZE=undefined
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-6']
      env: SCRIPT=test _CC=gcc-6 _CXX=g++-6
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-7']
      env: SCRIPT=test _CC=gcc-7 _CXX=g++-7
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-8']
      env: SCRIPT=test _CC=gcc-8 _CXX=g++-8
    - addons:
        apt:
          packages: ['g++-arm-linux-gnueabihf']
      env: SCRIPT=build _CC=arm-linux-gnueabihf-gcc _CXX=arm-linux-gnueabihf-g++
    - env: SCRIPT=test _CC=clang _CXX=clang++
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.5']
          packages: ['clang-3.5']
      env: SCRIPT=test _CC=clang-3.5 _CXX=clang++-3.5 SANITIZE=address
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.6']
          packages: ['clang-3.6']
      env: SCRIPT=test _CC=clang-3.6 _CXX=clang++-3.6 SANITIZE=leak
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.7']
          packages: ['clang-3.7']
      env: SCRIPT=test _CC=clang-3.7 _CXX=clang++-3.7
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8']
          packages: ['clang-3.8']
      env: SCRIPT=test _CC=clang-3.8 _CXX=clang++-3.8 SANITIZE=undefined
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-3.9']
          packages: ['clang-3.9']
      env: SCRIPT=test _CC=clang-3.9 _CXX=clang++-3.9
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-4.0']
          packages: ['clang-4.0']
      env: SCRIPT=test _CC=clang-4.0 _CXX=clang++-4.0
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['clang-5.0']
      env: SCRIPT=test _CC=clang-5.0 _CXX=clang++-5.0
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['clang-6.0']
      env: SCRIPT=test _CC=clang-6.0 _CXX=clang++-6.0
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-7']
          packages: ['clang-7']
      env: SCRIPT=test _CC=clang-7 _CXX=clang++-7
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-8']
          packages: ['clang-8']
      env: SCRIPT=test _CC=clang-8 _CXX=clang++-8
    - env: SCRIPT=coverage
    - os: osx
      osx_image: xcode7.3
      env: SCRIPT=test
    - os: osx
      osx_image: xcode8.3
      env: SCRIPT=test
    - os: osx
      osx_image: xcode9.4
      env: SCRIPT=test
    - os: osx
      osx_image: xcode10
      env: SCRIPT=test SANITIZE=address
    - env: SCRIPT=arduino VERSION=1.6.7 BOARD=arduino:avr:uno
    - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:samd:mkr1000
    - env: SCRIPT=platformio BOARD=uno
    - env: SCRIPT=platformio BOARD=esp01
    - addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['clang-6.0','llvm-6.0']
      env: SCRIPT=fuzz CLANG=6.0
cache:
  directories:
    - "~/.platformio"
    - "fuzzing/json_corpus"
    - "fuzzing/msgpack_corpus"
script: scripts/travis/$SCRIPT.sh
